<template>
  <div>    
    <el-table align="center" :data="userData" style="width: 100%">
        <el-table-column prop="realName" label="用户昵称">
        </el-table-column>
        <el-table-column prop="email" label="用户邮箱">
        </el-table-column>
        <el-table-column prop="operation" label="操作">
            <template slot-scope="scope">
                <!-- <el-popconfirm
                    title="确认删除吗？"
                    confirmButtonText='确定'
                    cancelButtonText='取消'
                    trigger="click"
                    @onConfirm="delUser(scope.row)"
                > -->
                <el-button @click="delUser(scope.row)" slot="reference" type="primary">删除</el-button>
                <!-- </el-popconfirm> -->
            </template>
        </el-table-column>
    </el-table>
  </div>
</template>

<script>
import Service from '@/service/request'

export default {
    data() {
        return {
            userData: []
        }
    },
    methods: {
        delUser(data) {
            console.log("drlUser", data)
            Service.delUser(data.id).then(async res => {
                console.log("delUser", res)
                this.userData = await Service.getUserData()
                // this.reload()
            })
        }
    },
    async created() {
        this.userData = await Service.getUserData()
        console.log("userData >>>>", this.userData)
    }
}
</script>

<style>

</style>